package com.itheima01;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;
import java.util.Scanner;

public class Test02 {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        DatagramSocket datagramSocket = new DatagramSocket();
        InetAddress byName = InetAddress.getByName("127.0.0.1");

        while (true) {

            String s = sc.nextLine();
            if(s.equals("886")){
                break;
            }
            byte[] bytes = s.getBytes();
            DatagramPacket datagramPacket = new DatagramPacket(bytes, bytes.length, byName, 8888);

            datagramSocket.send(datagramPacket);
        }

        datagramSocket.close();
    }
}
